<template>
  <div>
    <div class="seed_top_banner">
      <div class="seed_back_arrow" @click="back">
        <svg class="icon" aria-hidden="true">
          <use xlink:href="#icon-zuo"></use>
        </svg>
      </div>
      <div class="seed_page_title"><span>分销设置</span></div>
      <div class="seed_page_tool"></div>
    </div>
    <!--表单-->
    <div class="seed_my_setpwd_container">
      <div class="seed_my_setpwd_container_ch">
        <p class="seed_my_setpwd_container_name">退款操作</p>
      </div>
      <div class="seed_my_setpwd_container_ch" style="height: 4rem; background-color: #fff;line-height: 4rem">
        <p style="margin-left: 0.8rem">
          <input type="radio" class="seed_radio" value="0" name="is_need_refund" v-model="param.is_need_refund" @change="check"/> 线上&emsp;
          <input type="radio" class="seed_radio" value="1" name="is_need_refund" v-model="param.is_need_refund" @change="check"/> 线下
        </p>
      </div>
      <div class="seed_my_setpwd_container_ch">
        <p class="seed_my_setpwd_container_name">购买协议</p>
      </div>
      <div class="seed_my_setpwd_container_ch" style="height: 4rem; background-color: #fff;line-height: 4rem">
        <p style="margin-left: 0.8rem">
          <input type="radio" class="seed_radio" value="0" name="is_need_protocol" v-model="param.is_need_protocol" @change="check"/> 不需要&emsp;
          <input type="radio" class="seed_radio" value="1" name="is_need_protocol" v-model="param.is_need_protocol" @change="check"/> 需要
        </p>
      </div>
      <div class="seed_my_setpwd_container_ch">
        <p class="seed_my_setpwd_container_name">
          提现扣比<span class="seed_my_dis_set_tip"> (提现扣除百分之几奖励上级分销商)</span>
        </p>
      </div>
      <div class="seed_my_setpwd_container_ch" style="height: 4rem">
        <input type="number" class="seed_my_setpwd_container_input" v-model="param.bonus_auto_deduct_rate" placeholder="请输入提现扣比"/>
      </div>
      <div class="seed_my_setpwd_container_ch">
        <p class="seed_my_setpwd_container_name">
          奖励层数<span class="seed_my_dis_set_tip"> (下级提现, 上级多少层内可以获取奖金)</span>
        </p>
      </div>
      <div class="seed_my_setpwd_container_ch" style="height: 4rem">
        <input type="number" class="seed_my_setpwd_container_input" v-model="param.bonus_get_floor" placeholder="请输入奖励层数"/>
      </div>
      <div class="seed_my_setpwd_container_ch">
        <p class="seed_my_setpwd_container_name">
          提现设置<span class="seed_my_dis_set_tip"> (最小提现额度不能低于1元)</span>
        </p>
      </div>
      <div class="seed_my_setpwd_container_ch" style="height: 4rem">
        <input type="number" class="seed_my_setpwd_container_input" v-model="param.distribute_withdraw_set" placeholder="请输入最小提现额"/>
      </div>
      <div class="seed_my_setpwd_container_ch">
        <p class="seed_my_setpwd_container_name">
          强购基数<span class="seed_my_dis_set_tip"></span>
        </p>
      </div>
      <div class="seed_my_setpwd_container_ch" style="height: 4rem">
        <input type="number" class="seed_my_setpwd_container_input" v-model="param.distribute_withdraw_force_base" placeholder="请输入强制购买基数"/>
      </div>
    </div>
    <button class="seed_my_dis_set_confirm" @click="save">保存</button>
  </div>
</template>
<script>
export default {
  data () {
    return {
      param: {
        distribute_money_set: '',
        distribute_rate_set: '',
        distribute_withdraw_set: ''
      }
    }
  },
  created () {
    this.getInfo()
  },
  methods: {
    back () {
      this.$router.push({name: 'my-my'})
    },
    getInfo () {
      this.$request.DistributeSet().then(data => {
        this.param = data
      })
    },
    save () {
      this.$MessageBox.confirm('确定要修改设置吗?').then(action => {
        let data = this.param
        data.save = 1
        this.$request.DistributeSet(data).then(data => {
          this.$toast('设置成功')
        })
      })
    }
  }
}
</script>
